package demo1;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 使用Spring 完成对对象的创建和依赖注入
 */

public class Demo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext("demo1");// 扫描包
        User user = context.getBean(User.class);
        user.sayHello();
    }
}
